1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.gfileutils; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import derelict.glib.gquark; 34 import derelict.glib.gerror; 35 import core.stdc.config; 36 37 extern (C): 38 39 alias _Anonymous_0 GFileError; 40 alias _Anonymous_1 GFileTest; 41 42 enum _Anonymous_0 43 { 44 G_FILE_ERROR_EXIST = 0, 45 G_FILE_ERROR_ISDIR = 1, 46 G_FILE_ERROR_ACCES = 2, 47 G_FILE_ERROR_NAMETOOLONG = 3, 48 G_FILE_ERROR_NOENT = 4, 49 G_FILE_ERROR_NOTDIR = 5, 50 G_FILE_ERROR_NXIO = 6, 51 G_FILE_ERROR_NODEV = 7, 52 G_FILE_ERROR_ROFS = 8, 53 G_FILE_ERROR_TXTBSY = 9, 54 G_FILE_ERROR_FAULT = 10, 55 G_FILE_ERROR_LOOP = 11, 56 G_FILE_ERROR_NOSPC = 12, 57 G_FILE_ERROR_NOMEM = 13, 58 G_FILE_ERROR_MFILE = 14, 59 G_FILE_ERROR_NFILE = 15, 60 G_FILE_ERROR_BADF = 16, 61 G_FILE_ERROR_INVAL = 17, 62 G_FILE_ERROR_PIPE = 18, 63 G_FILE_ERROR_AGAIN = 19, 64 G_FILE_ERROR_INTR = 20, 65 G_FILE_ERROR_IO = 21, 66 G_FILE_ERROR_PERM = 22, 67 G_FILE_ERROR_NOSYS = 23, 68 G_FILE_ERROR_FAILED = 24 69 } 70 71 enum _Anonymous_1 72 { 73 G_FILE_TEST_IS_REGULAR = 1, 74 G_FILE_TEST_IS_SYMLINK = 2, 75 G_FILE_TEST_IS_DIR = 4, 76 G_FILE_TEST_IS_EXECUTABLE = 8, 77 G_FILE_TEST_EXISTS = 16 78 } 79 80 version(Derelict_Link_Static) 81 { 82 extern( C ) nothrow 83 { 84 GQuark g_file_error_quark(); 85 GFileError g_file_error_from_errno(gint err_no); 86 gboolean g_file_test(const(gchar)* filename, GFileTest test); 87 gboolean g_file_get_contents(const(gchar)* filename, gchar** contents, gsize* length, GError** error); 88 gboolean g_file_set_contents(const(gchar)* filename, const(gchar)* contents, gssize length, GError** error); 89 gchar* g_file_read_link(const(gchar)* filename, GError** error); 90 gchar* g_mkdtemp(gchar* tmpl); 91 gchar* g_mkdtemp_full(gchar* tmpl, gint mode); 92 gint g_mkstemp(gchar* tmpl); 93 gint g_mkstemp_full(gchar* tmpl, gint flags, gint mode); 94 gint g_file_open_tmp(const(gchar)* tmpl, gchar** name_used, GError** error); 95 gchar* g_dir_make_tmp(const(gchar)* tmpl, GError** error); 96 gchar* g_build_path(const(gchar)* separator, const(gchar)* first_element, ...); 97 gchar* g_build_pathv(const(gchar)* separator, gchar** args); 98 gchar* g_build_filename(const(gchar)* first_element, ...); 99 gchar* g_build_filenamev(gchar** args); 100 gint g_mkdir_with_parents(const(gchar)* pathname, gint mode); 101 gboolean g_path_is_absolute(const(gchar)* file_name); 102 const(gchar)* g_path_skip_root(const(gchar)* file_name); 103 const(gchar)* g_basename(const(gchar)* file_name); 104 gchar* g_get_current_dir(); 105 gchar* g_path_get_basename(const(gchar)* file_name); 106 gchar* g_path_get_dirname(const(gchar)* file_name); 107 } 108 } 109 else 110 { 111 extern( C ) nothrow 112 { 113 alias da_g_file_error_quark = GQuark function(); 114 alias da_g_file_error_from_errno = GFileError function(gint err_no); 115 alias da_g_file_test = gboolean function(const(gchar)* filename, GFileTest test); 116 alias da_g_file_get_contents = gboolean function(const(gchar)* filename, gchar** contents, gsize* length, GError** error); 117 alias da_g_file_set_contents = gboolean function(const(gchar)* filename, const(gchar)* contents, gssize length, GError** error); 118 alias da_g_file_read_link = gchar* function(const(gchar)* filename, GError** error); 119 alias da_g_mkdtemp = gchar* function(gchar* tmpl); 120 alias da_g_mkdtemp_full = gchar* function(gchar* tmpl, gint mode); 121 alias da_g_mkstemp = gint function(gchar* tmpl); 122 alias da_g_mkstemp_full = gint function(gchar* tmpl, gint flags, gint mode); 123 alias da_g_file_open_tmp = gint function(const(gchar)* tmpl, gchar** name_used, GError** error); 124 alias da_g_dir_make_tmp = gchar* function(const(gchar)* tmpl, GError** error); 125 alias da_g_build_path = gchar* function(const(gchar)* separator, const(gchar)* first_element, ...); 126 alias da_g_build_pathv = gchar* function(const(gchar)* separator, gchar** args); 127 alias da_g_build_filename = gchar* function(const(gchar)* first_element, ...); 128 alias da_g_build_filenamev = gchar* function(gchar** args); 129 alias da_g_mkdir_with_parents = gint function(const(gchar)* pathname, gint mode); 130 alias da_g_path_is_absolute = gboolean function(const(gchar)* file_name); 131 alias da_g_path_skip_root = const(gchar)* function(const(gchar)* file_name); 132 alias da_g_basename = const(gchar)* function(const(gchar)* file_name); 133 alias da_g_get_current_dir = gchar* function(); 134 alias da_g_path_get_basename = gchar* function(const(gchar)* file_name); 135 alias da_g_path_get_dirname = gchar* function(const(gchar)* file_name); 136 } 137 138 __gshared 139 { 140 da_g_file_error_quark g_file_error_quark; 141 da_g_file_error_from_errno g_file_error_from_errno; 142 da_g_file_test g_file_test; 143 da_g_file_get_contents g_file_get_contents; 144 da_g_file_set_contents g_file_set_contents; 145 da_g_file_read_link g_file_read_link; 146 da_g_mkdtemp g_mkdtemp; 147 da_g_mkdtemp_full g_mkdtemp_full; 148 da_g_mkstemp g_mkstemp; 149 da_g_mkstemp_full g_mkstemp_full; 150 da_g_file_open_tmp g_file_open_tmp; 151 da_g_dir_make_tmp g_dir_make_tmp; 152 da_g_build_path g_build_path; 153 da_g_build_pathv g_build_pathv; 154 da_g_build_filename g_build_filename; 155 da_g_build_filenamev g_build_filenamev; 156 da_g_mkdir_with_parents g_mkdir_with_parents; 157 da_g_path_is_absolute g_path_is_absolute; 158 da_g_path_skip_root g_path_skip_root; 159 da_g_basename g_basename; 160 da_g_get_current_dir g_get_current_dir; 161 da_g_path_get_basename g_path_get_basename; 162 da_g_path_get_dirname g_path_get_dirname; 163 } 164 }